package Lab;

import java.util.function.Consumer;
import java.util.function.IntFunction;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.01.29.11.27
 */
public class Lam1 {
    public static void main(String[] args) {
        //传统方式 接口实现类
       
    A b=new B();
   // b.pf(2);
        System.out.println(b.pf(2));
      //int b=()->i*i;
        //直接实例化接口，不允许
        A a=new A() {
            @Override
            public int pf(int i) {
                return i*i;
            }
        };
        System.out.println(a.pf(4));
        //java1.8 lambda;
        A c= i->i*i;
        System.out.println(c.pf(3));
        System.out.println(((A)y->y*y*y).pf(9));
        IntFunction s= i->i*i;
        System.out.println(s.apply(3));

    }
}
